<template>
  <div>
    <div class="gva-search-box">
      <el-form ref="elSearchFormRef" :inline="true" :model="searchInfo" class="demo-form-inline" :rules="searchRule" @keyup.enter="onSubmit">
      <el-form-item label="创建日期" prop="createdAt" >
      <template #label>
        <span>
          创建日期
          <el-tooltip content="搜索范围是开始日期（包含）至结束日期（不包含）">
            <el-icon><QuestionFilled /></el-icon>
          </el-tooltip>
        </span>
      </template>
      <el-date-picker v-model="searchInfo.startCreatedAt" type="datetime" placeholder="开始日期" :disabled-date="time=> searchInfo.endCreatedAt ? time.getTime() > searchInfo.endCreatedAt.getTime() : false"></el-date-picker>
       —
      <el-date-picker v-model="searchInfo.endCreatedAt" type="datetime" placeholder="结束日期" :disabled-date="time=> searchInfo.startCreatedAt ? time.getTime() < searchInfo.startCreatedAt.getTime() : false"></el-date-picker>
      </el-form-item>
        <el-form-item label="姓名:" prop="username">
          <el-input v-model="searchInfo.username" :clearable="true"  placeholder="请输入访客姓名" />
        </el-form-item>
        <el-form-item label="所属公司:" prop="company">
          <el-input v-model="searchInfo.company" :clearable="true"  placeholder="请输入所属公司" />
        </el-form-item>
        <el-form-item label="人员类型:" prop="visittype">
          <el-select v-model="searchInfo.visittype" class="m-2" placeholder="请输入人员类型" size="small">
            <el-option
                v-for="item in peoples"
                :key="item.value"
                :label="item.label"
                :value="item.value"
            />
          </el-select>
        </el-form-item>
        <el-form-item label="通行方式:" prop="passway">
          <el-select v-model="searchInfo.passway" class="m-2" placeholder="请输入通行方式" size="small">
            <el-option
                v-for="item in passways"
                :key="item.value"
                :label="item.label"
                :value="item.value"
            />
          </el-select>
        </el-form-item>
        <el-form-item label="设备类型:" prop="device">
          <el-select v-model="searchInfo.device" class="m-2" placeholder="请输入设备类型" size="small">
            <el-option
                v-for="item in devices"
                :key="item.value"
                :label="item.label"
                :value="item.value"
            />
          </el-select>
        </el-form-item>
        <el-form-item>
          <el-button type="primary" icon="search" @click="onSubmit">查询</el-button>
          <el-button icon="refresh" @click="onReset">重置</el-button>
        </el-form-item>
      </el-form>
    </div>
    <div class="gva-table-box">
        <div class="gva-btn-list">
            <el-button type="primary" icon="plus" @click="openDialog">新增</el-button>
            <el-popover v-model:visible="deleteVisible" :disabled="!multipleSelection.length" placement="top" width="160">
            <p>确定要删除吗？</p>
            <div style="text-align: right; margin-top: 8px;">
                <el-button type="primary" link @click="deleteVisible = false">取消</el-button>
                <el-button type="primary" @click="onDelete">确定</el-button>
            </div>
            <template #reference>
                <el-button icon="delete" style="margin-left: 10px;" :disabled="!multipleSelection.length" @click="deleteVisible = true">删除</el-button>
            </template>
            </el-popover>
        </div>
        <el-table
        ref="multipleTable"
        style="width: 100%"
        tooltip-effect="dark"
        :data="tableData"
        row-key="ID"
        @selection-change="handleSelectionChange"
        >
        <el-table-column type="selection" width="55" />
<!--        <el-table-column align="left" label="日期" width="180">-->
<!--            <template #default="scope">{{ formatDate(scope.row.CreatedAt) }}</template>-->
<!--        </el-table-column>-->
        <el-table-column align="left" label="访客姓名" prop="username" width="120" />
<!--        <el-table-column align="left" label="访客性别" prop="sex" width="120">-->
<!--            <template #default="scope">{{ formatBoolean(scope.row.sex) }}</template>-->
<!--        </el-table-column>-->
          <el-table-column align="left" label="公司" prop="company" width="120" />
          <el-table-column align="left" label="访客类型" prop="visittype" width="120">
            <template #default="scope">{{ scope.row.visittype ? '访客' : '访客' }}</template>
          </el-table-column>
<!--        <el-table-column align="left" label="手机号" prop="tel" width="120" />-->
          <el-table-column align="left" label="访问开始时间" width="180">
            <template #default="scope">{{ formatDate(scope.row.start) }}</template>
          </el-table-column>
          <el-table-column align="left" label="访问结束时间" width="180">
            <template #default="scope">{{ formatDate(scope.row.end) }}</template>
          </el-table-column>

        <el-table-column align="left" label="设备名称" prop="device" width="120" />
<!--          <el-table-column align="left" label="通行照片" prop="passimg" width="120" />-->
          <el-table-column
              align="left"
              label="头像"
              min-width="75"
              prop="passimg"
          >
            <template #default="scope">
              <CustomPic
                  style="margin-top:8px;margin-right: 65px;"
                  :pic-src="scope.row.passimg"
              />
            </template>
          </el-table-column>
          <el-table-column align="left" label="同行状态" prop="isvisited" width="120">
            <template #default="scope">{{ scope.row.isvisited ? '已通行' : '未通行' }}</template>
          </el-table-column>
<!--        <el-table-column align="left" label="被访人姓名" prop="touser" width="120" />-->
<!--        <el-table-column align="left" label="被访人电话" prop="totel" width="120" />-->
<!--        <el-table-column align="left" label="访问原因" prop="visitreason" width="120" />-->
<!--        <el-table-column align="left" label="通行方式" prop="passway" width="120">-->
<!--            <template #default="scope">{{ formatBoolean(scope.row.passway) }}</template>-->
<!--        </el-table-column>-->
<!--        <el-table-column align="left" label="通行目标" prop="passgoal" width="120">-->
<!--            <template #default="scope">{{ formatBoolean(scope.row.passgoal) }}</template>-->
<!--        </el-table-column>-->
<!--        <el-table-column align="left" label="touserjob字段" prop="touserjob" width="120" />-->
<!--        <el-table-column align="left" label="备注" prop="remark" width="120" />-->
<!--        <el-table-column align="left" label="选择区域" prop="area" width="120">-->
<!--            <template #default="scope">{{ formatBoolean(scope.row.area) }}</template>-->
<!--        </el-table-column>-->
        <el-table-column align="left" label="操作">
            <template #default="scope">
            <el-button type="primary" link class="table-button" @click="getDetails(scope.row)">
                <el-icon style="margin-right: 5px"><InfoFilled /></el-icon>
                查看详情
            </el-button>
<!--            <el-button type="primary" link icon="edit" class="table-button" @click="updateVisitFunc(scope.row)">变更</el-button>-->
            <el-button type="primary" link icon="delete" @click="deleteRow(scope.row)">删除</el-button>
            </template>
        </el-table-column>
        </el-table>
        <div class="gva-pagination">
            <el-pagination
            layout="total, sizes, prev, pager, next, jumper"
            :current-page="page"
            :page-size="pageSize"
            :page-sizes="[10, 30, 50, 100]"
            :total="total"
            @current-change="handleCurrentChange"
            @size-change="handleSizeChange"
            />
        </div>
    </div>

    <el-dialog v-model="dialogFormVisible" :before-close="closeDialog" :title="type==='create'?'添加':'修改'" destroy-on-close>
      <el-scrollbar height="500px">
          <el-form :model="formData" label-position="right" ref="elFormRef" :rules="rule" label-width="80px">
            <el-form-item label="访客姓名:"  prop="username" >
              <el-input v-model="formData.username" :clearable="true"  placeholder="请输入访客姓名" />
            </el-form-item>
            <el-form-item label="员工性别:"  prop="sex" >
              <el-radio v-model="formData.sex" :label=true>男</el-radio>
              <el-radio v-model="formData.sex" :label=false>女</el-radio>
              <!--              <el-switch v-model="formData.sex" active-color="#13ce66" inactive-color="#ff4949" active-text="男" inactive-text="女" clearable ></el-switch>-->
            </el-form-item>
            <el-form-item label="手机号:"  prop="tel" >
              <el-input v-model="formData.tel" :clearable="true"  placeholder="请输入手机号" />
            </el-form-item>
            <el-form-item label="公司:"  prop="company" >
              <el-input v-model="formData.company" :clearable="true"  placeholder="请输入公司" />
            </el-form-item>
            <el-form-item label="设备名称:"  prop="device" >
<!--              <el-input v-model="formData.device" :clearable="true"  placeholder="请输入设备名称" />-->
              <el-select v-model="formData.device" class="m-2" placeholder="请输入设备名称" size="small">
                <el-option
                    v-for="item in devices"
                    :key="item.value"
                    :label="item.label"
                    :value="item.value"
                />
              </el-select>
            </el-form-item>
            <el-form-item label="被访人姓名:"  prop="touser" >
              <el-input v-model="formData.touser" :clearable="true"  placeholder="请输入被访人姓名" />
            </el-form-item>
            <el-form-item label="被访人电话:"  prop="totel" >
              <el-input v-model="formData.totel" :clearable="true"  placeholder="请输入被访人电话" />
            </el-form-item>
            <el-form-item label="访问原因:"  prop="visitreason" >
<!--              <el-input v-model="formData.visitreason" :clearable="true"  placeholder="请输入访问原因" />-->
              <el-select v-model="formData.visitreason" class="m-2" placeholder="请输入访问原因" size="small">
                <el-option
                    v-for="item in visitreasons"
                    :key="item.value"
                    :label="item.label"
                    :value="item.value"
                />
              </el-select>
            </el-form-item>
            <el-form-item label="同行状态:"  prop="isvisited" >
              <el-switch v-model="formData.isvisited" active-color="#13ce66" inactive-color="#ff4949" active-text="已通行" inactive-text="未通行" clearable ></el-switch>
            </el-form-item>
            <el-form-item label="访问开始时间:"  prop="start" >
              <el-date-picker v-model="formData.start" type="date" style="width:100%" placeholder="选择日期" :clearable="true"  />
            </el-form-item>
            <el-form-item label="访问结束时间:"  prop="end" >
              <el-date-picker v-model="formData.end" type="date" style="width:100%" placeholder="选择日期" :clearable="true"  />
            </el-form-item>
<!--            <el-form-item label="通行照片:"  prop="passimg" >-->
<!--              <el-input v-model="formData.passimg" :clearable="true"  placeholder="请输入通行照片" />-->
<!--            </el-form-item>-->
            <el-form-item
                label="通行照片"
                label-width="80px"
            >
              <div
                  style="display:inline-block"
                  @click="openHeaderChange"
              >
                <img
                    v-if="formData.passimg"
                    alt="通行照片"
                    class="header-img-box"
                    :src="(formData.passimg && formData.passimg.slice(0, 4) !== 'http')?path+formData.passimg:formData.passimg"
                >
                <div
                    v-else
                    class="header-img-box"
                >从媒体库选择</div>
              </div>
            </el-form-item>
            <el-form-item label="通行方式:"  prop="passway" >
<!--              <el-switch v-model="formData.passway" active-color="#13ce66" inactive-color="#ff4949" active-text="扫码" inactive-text="刷脸" clearable ></el-switch>-->
              <el-radio v-model="formData.passway" :label=true>扫码</el-radio>
              <el-radio v-model="formData.passway" :label=false>刷脸</el-radio>
            </el-form-item>
            <el-form-item label="通行目标:"  prop="passgoal" >
<!--              <el-switch v-model="formData.passgoal" active-color="#13ce66" inactive-color="#ff4949" active-text="是" inactive-text="否" clearable ></el-switch>-->
              <el-radio v-model="formData.passgoal" :label=true>如工地</el-radio>
              <el-radio v-model="formData.passgoal" :label=false>入仓</el-radio>
            </el-form-item>
            <el-form-item label="被访人职位:"  prop="touserjob" >
              <el-select v-model="formData.touserjob" class="m-2" placeholder="请输入被访人职位" size="small">
                <el-option
                    v-for="item in touserjobs"
                    :key="item.value"
                    :label="item.label"
                    :value="item.value"
                />
              </el-select>
<!--              <el-input v-model="formData.touserjob" :clearable="true"  placeholder="请输入touserjob字段" />-->
            </el-form-item>
            <el-form-item label="备注:"  prop="remark" >
              <el-input v-model="formData.remark" :clearable="true"  placeholder="请输入备注" />
            </el-form-item>
            <el-form-item label="选择区域:"  prop="area" >
              <el-switch v-model="formData.area" active-color="#13ce66" inactive-color="#ff4949" active-text="东部地区" inactive-text="西部地区" clearable ></el-switch>
            </el-form-item>
          </el-form>
      </el-scrollbar>
      <template #footer>
        <div class="dialog-footer">
          <el-button @click="closeDialog">取 消</el-button>
          <el-button type="primary" @click="enterDialog">确 定</el-button>
        </div>
      </template>
    </el-dialog>
    <ChooseImg
        ref="chooseImg"
        :target="formData"
        :target-key="`passimg`"
    />
    <el-dialog v-model="detailShow" style="width: 800px" lock-scroll :before-close="closeDetailShow" title="查看详情" destroy-on-close>
      <el-scrollbar height="550px">
        <el-descriptions column="1" border>
                <el-descriptions-item label="访客姓名">
                        {{ formData.username }}
                </el-descriptions-item>
                <el-descriptions-item label="访客性别">
           {{ formatBoolean(formData.sex)? '男性' : '女性' }}
                </el-descriptions-item>
                <el-descriptions-item label="手机号">
                        {{ formData.tel }}
                </el-descriptions-item>
                <el-descriptions-item label="公司">
                        {{ formData.company }}
                </el-descriptions-item>
                <el-descriptions-item label="访客类型">
                  {{ formatBoolean(formData.visittype)? '访客' : '访客' }}
                </el-descriptions-item>
                <el-descriptions-item label="设备名称">
                        {{ formData.device }}
                </el-descriptions-item>
                <el-descriptions-item label="被访人姓名">
                        {{ formData.touser }}
                </el-descriptions-item>
                <el-descriptions-item label="被访人电话">
                        {{ formData.totel }}
                </el-descriptions-item>
                <el-descriptions-item label="访问原因">
                        {{ formData.visitreason }}
                </el-descriptions-item>
                <el-descriptions-item label="同行状态">
          {{ formatBoolean(formData.isvisited) ? '已通行' : '未通行' }}
                </el-descriptions-item>
                <el-descriptions-item label="访问开始时间">
                      {{ formatDate(formData.start) }}
                </el-descriptions-item>
                <el-descriptions-item label="访问结束时间">
                      {{ formatDate(formData.end) }}
                </el-descriptions-item>
<!--                <el-descriptions-item label="通行照片">-->
<!--                        {{ formData.passimg }}-->
<!--                </el-descriptions-item>-->
                <el-descriptions-item label="通行方式">
                  {{ formatBoolean(formData.passway)? '扫码' : '刷脸' }}
                </el-descriptions-item>
        </el-descriptions>
      </el-scrollbar>
    </el-dialog>
  </div>
</template>

<script setup>
import {
  createVisit,
  deleteVisit,
  deleteVisitByIds,
  updateVisit,
  findVisit,
  getVisitList
} from '@/api/visit'

// 全量引入格式化工具 请按需保留
import { getDictFunc, formatDate, formatBoolean, filterDict, ReturnArrImg, onDownloadFile } from '@/utils/format'
import { ElMessage, ElMessageBox } from 'element-plus'
import { ref, reactive } from 'vue'

import CustomPic from "@/components/customPic/index.vue";
import ChooseImg from '@/components/chooseImg/index.vue'
import WarningBar from '@/components/warningBar/warningBar.vue'
defineOptions({
    name: 'Visit'
})

// 自动化生成的字典（可能为空）以及字段
const formData = ref({
        username: '',
        sex: false,
        tel: '',
        company: '',
        visittype: false,
        device: '',
        touser: '',
        totel: '',
        visitreason: '',
        isvisited: false,
        start: new Date(),
        end: new Date(),
        passimg: '',
        passway: false,
        passgoal: false,
        touserjob: '',
        remark: '',
        area: false,
        })


// 验证规则
const rule = reactive({
  tel: [
    { required: true, message: "请输入联系方式", trigger: "blur" },
    { min: 11, max: 11, message: "请输入11位手机号码", trigger: "blur" },
    {
      pattern: /^(13[0-9]|14[579]|15[0-3,5-9]|16[6]|17[0135678]|18[0-9]|19[89])\d{8}$/,
      //pattern: /^1[3456789]\d{9}$/,
      message: "请输入正确的手机号码",
    },
  ],
  totel: [
    { required: true, message: "请输入联系方式", trigger: "blur" },
    { min: 11, max: 11, message: "请输入11位手机号码", trigger: "blur" },
    {
      pattern: /^(13[0-9]|14[579]|15[0-3,5-9]|16[6]|17[0135678]|18[0-9]|19[89])\d{8}$/,
      //pattern: /^1[3456789]\d{9}$/,
      message: "请输入正确的手机号码",
    },
  ],
  idcard: [
    {
      pattern: /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/,
      message: "请输入正确的身份证号码",
    }
  ]
})

const searchRule = reactive({
  createdAt: [
    { validator: (rule, value, callback) => {
      if (searchInfo.value.startCreatedAt && !searchInfo.value.endCreatedAt) {
        callback(new Error('请填写结束日期'))
      } else if (!searchInfo.value.startCreatedAt && searchInfo.value.endCreatedAt) {
        callback(new Error('请填写开始日期'))
      } else if (searchInfo.value.startCreatedAt && searchInfo.value.endCreatedAt && (searchInfo.value.startCreatedAt.getTime() === searchInfo.value.endCreatedAt.getTime() || searchInfo.value.startCreatedAt.getTime() > searchInfo.value.endCreatedAt.getTime())) {
        callback(new Error('开始日期应当早于结束日期'))
      } else {
        callback()
      }
    }, trigger: 'change' }
  ],
})
const openHeaderChange = () => {
  chooseImg.value.open()
}
const chooseImg = ref(null)
const peoples = [
  {
    value: true,
    label: '访客',
  },
  {
    value: false,
    label: '访客',
  },
]
const areas = [
  {
    value: '东部地区',
    label: '东部地区',
  },
  {
    value: '西部地区',
    label: '西部地区',
  },
]
const passways = [
  {
    value: true,
    label: '扫码',
  },
  {
    value: false,
    label: '刷脸',
  },
]
const touserjobs = [
  {
    value: '职位1',
    label: '职位1',
  },
  {
    value: '职位2',
    label: '职位2',
  },
]
const visitreasons = [
  {
    value: '原因1',
    label: '原因1',
  },
  {
    value: '原因2',
    label: '原因2',
  },
]
const devices = [
  {
    value: '入口闸机01',
    label: '入口闸机01',
  },
  {
    value: '入口闸机02',
    label: '入口闸机02',
  },
  {
    value: '入口闸机03',
    label: '入口闸机03',
  },
  {
    value: '入口闸机04',
    label: '入口闸机04',
  },
  {
    value: '入口闸机05',
    label: '入口闸机05',
  },
]
const elFormRef = ref()
const elSearchFormRef = ref()

// =========== 表格控制部分 ===========
const page = ref(1)
const total = ref(0)
const pageSize = ref(10)
const tableData = ref([])
const searchInfo = ref({})

// 重置
const onReset = () => {
  searchInfo.value = {}
  getTableData()
}

// 搜索
const onSubmit = () => {
  elSearchFormRef.value?.validate(async(valid) => {
    if (!valid) return
    page.value = 1
    pageSize.value = 10
    if (searchInfo.value.sex === ""){
        searchInfo.value.sex=null
    }
    if (searchInfo.value.visittype === ""){
        searchInfo.value.visittype=null
    }
    if (searchInfo.value.isvisited === ""){
        searchInfo.value.isvisited=null
    }
    if (searchInfo.value.passway === ""){
        searchInfo.value.passway=null
    }
    if (searchInfo.value.passgoal === ""){
        searchInfo.value.passgoal=null
    }
    if (searchInfo.value.area === ""){
        searchInfo.value.area=null
    }
    getTableData()
  })
}

// 分页
const handleSizeChange = (val) => {
  pageSize.value = val
  getTableData()
}

// 修改页面容量
const handleCurrentChange = (val) => {
  page.value = val
  getTableData()
}

// 查询
const getTableData = async() => {
  const table = await getVisitList({ page: page.value, pageSize: pageSize.value, ...searchInfo.value })
  if (table.code === 0) {
    tableData.value = table.data.list
    total.value = table.data.total
    page.value = table.data.page
    pageSize.value = table.data.pageSize
  }
}

getTableData()

// ============== 表格控制部分结束 ===============

// 获取需要的字典 可能为空 按需保留
const setOptions = async () =>{
  genderOptions.value = await getDictFunc('gender')
}

// 获取需要的字典 可能为空 按需保留
setOptions()


// 多选数据
const multipleSelection = ref([])
// 多选
const handleSelectionChange = (val) => {
    multipleSelection.value = val
}

// 删除行
const deleteRow = (row) => {
    ElMessageBox.confirm('确定要删除吗?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
    }).then(() => {
            deleteVisitFunc(row)
        })
    }


// 批量删除控制标记
const deleteVisible = ref(false)

// 多选删除
const onDelete = async() => {
      const ids = []
      if (multipleSelection.value.length === 0) {
        ElMessage({
          type: 'warning',
          message: '请选择要删除的数据'
        })
        return
      }
      multipleSelection.value &&
        multipleSelection.value.map(item => {
          ids.push(item.ID)
        })
      const res = await deleteVisitByIds({ ids })
      if (res.code === 0) {
        ElMessage({
          type: 'success',
          message: '删除成功'
        })
        if (tableData.value.length === ids.length && page.value > 1) {
          page.value--
        }
        deleteVisible.value = false
        getTableData()
      }
    }

// 行为控制标记（弹窗内部需要增还是改）
const type = ref('')

// 更新行
const updateVisitFunc = async(row) => {
    const res = await findVisit({ ID: row.ID })
    type.value = 'update'
    if (res.code === 0) {
        formData.value = res.data.revisit
        dialogFormVisible.value = true
    }
}


// 删除行
const deleteVisitFunc = async (row) => {
    const res = await deleteVisit({ ID: row.ID })
    if (res.code === 0) {
        ElMessage({
                type: 'success',
                message: '删除成功'
            })
            if (tableData.value.length === 1 && page.value > 1) {
            page.value--
        }
        getTableData()
    }
}

// 弹窗控制标记
const dialogFormVisible = ref(false)


// 查看详情控制标记
const detailShow = ref(false)


// 打开详情弹窗
const openDetailShow = () => {
  detailShow.value = true
}


// 打开详情
const getDetails = async (row) => {
  // 打开弹窗
  const res = await findVisit({ ID: row.ID })
  if (res.code === 0) {
    formData.value = res.data.revisit
    openDetailShow()
  }
}


// 关闭详情弹窗
const closeDetailShow = () => {
  detailShow.value = false
  formData.value = {
          username: '',
          sex: false,
          tel: '',
          company: '',
          visittype: false,
          device: '',
          touser: '',
          totel: '',
          visitreason: '',
          isvisited: false,
          start: new Date(),
          end: new Date(),
          passimg: '',
          passway: false,
          passgoal: false,
          touserjob: '',
          remark: '',
          area: false,
          }
}


// 打开弹窗
const openDialog = () => {
    type.value = 'create'
    dialogFormVisible.value = true
}

// 关闭弹窗
const closeDialog = () => {
    dialogFormVisible.value = false
    formData.value = {
        username: '',
        sex: false,
        tel: '',
        company: '',
        visittype: false,
        device: '',
        touser: '',
        totel: '',
        visitreason: '',
        isvisited: false,
        start: new Date(),
        end: new Date(),
        passimg: '',
        passway: false,
        passgoal: false,
        touserjob: '',
        remark: '',
        area: false,
        }
}
// 弹窗确定
const enterDialog = async () => {
     elFormRef.value?.validate( async (valid) => {
             if (!valid) return
              let res
              switch (type.value) {
                case 'create':
                  res = await createVisit(formData.value)
                  break
                case 'update':
                  res = await updateVisit(formData.value)
                  break
                default:
                  res = await createVisit(formData.value)
                  break
              }
              if (res.code === 0) {
                ElMessage({
                  type: 'success',
                  message: '创建/更改成功'
                })
                closeDialog()
                getTableData()
              }
      })
}



function myrefresh(){
  window.location.reload()
}


setTimeout('myrefresh()',2000) // 指定2秒刷新一次
</script>


<style lang="scss">
.header-img-box {
  @apply w-52 h-52 border border-solid border-gray-300 rounded-xl flex justify-center items-center cursor-pointer;
}
</style>